const validatePass = (rule:any, value:string, callback:Function) => {
  const flag = /^[A-Za-z-]+$/.test(value); // 输入不是英文
  if (value === '') {
    return callback(new Error('名称不能为空'));
  }
  if(!flag) {
    return callback(new Error('请输入英文名称'))
  } else {
    return callback()
  }
};

export const tableOption = {
  labelPosition: 'right',
  labelWidth: 110,
  border: true,
  index: true,
  indexLabel: '序号',
  emptyBtn: true,
  emptyText: '清空',
  indexWidth: 60,
  stripe: true,
  menuAlign: 'center',
  align: 'center',
  searchMenuSpan: 6,
  dialogWidth:'50%',
  searchMenuPosition: 'left',
  searchLabelWidth: 'auto',
  column: [
    {
      type: 'input',
      label: '组件中文名称',
      prop: 'compZh',
      search:true,
      rules:[{
        required: true,
        message: '名称必须填写',
        trigger: 'blur'
      }],
    },
    {
      type: 'input',
      label: '组件英文名称',
      prop: 'compEn',
      rules:[{
        required: true,
        validator: validatePass,
        trigger: 'blur'
      }],
      labelWidth:130,
    },
    {
      type: 'input',
      label: '数据源',
      prop: 'url',
      rules:[{
        required: true,
        message: '建筑中文名称必须填写',
        trigger: 'blur'
      }],
      search:true,
      overHidden: true
    },
    // {
    //   type: 'input',
    //   label: '请求参数',
    //   prop: 'buildingsCn',
    //   labelWidth:130,
    //   overHidden: true
    // },
    {
      type: 'textarea',
      label: '备注',
      prop: 'description',
      labelWidth:110,
    }
  ]
}
